package xyz.xiangyushui.controller.membership.reserveDesserts;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



import xyz.xiangyushui.dao.user.member.ReservationHistoryDao;
import xyz.xiangyushui.javaBean.membership.Reservation;

/**
 * Servlet implementation class MyReservation
 */
@WebServlet("/member/myReservation")
public class MyReservation extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private ReservationHistoryDao rhd;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public MyReservation() {
        super();
        rhd=new ReservationHistoryDao();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println((String) request.getSession(false).getAttribute("userName"));
		List<Reservation> reservations=rhd.getMyChangableReservation((String) request.getSession(false).getAttribute("userName"));
		System.out.println(reservations.size());
		request.setAttribute("reservations", reservations);
		request.getRequestDispatcher("/member/reserveDesserts/myReservation.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
